<%@ page language="java" contentType="text/html; charset=UTF-8" isErrorPage="true" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="pagePath" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="${pagePath}/page/static/css/reset.css">
<link rel="stylesheet" type="text/css" href="${pagePath}/page/static/css/main.css">
<title>校园二手交易网-商品列表</title>
</head>
<body>
	<div class="header_con">
		<div class="header">
			<div class="welcome fl">欢迎来到 校园二手交易网！</div>
			<div class="fr">
				<div class="user_link fl">
					<c:if test="${!empty loguser}">
						欢迎您：<em style="color: red;">${loguser.username}</em>
						<span>|</span>
						<a href="${pagePath}/logout.do">退出</a>
					</c:if>
				</div>
				<div class="login_btn fl">
					<c:if test="${empty loguser}">
						<a href="${pagePath}/login.do">登录</a>
						<span>|</span>
						<a href="${pagePath}/register.do">注册</a>
					</c:if>
				</div>
			</div>
		</div>
	</div>
	<div class="search_bar clearfix">
		<a href="${pagePath}/index.do" class="logo fl"><img src="${pagePath}/page/static/images/logo.png"></a>
		<div class="search_con fl">
			<form action="${pagePath}/goods.do">
				<input type="text" class="input_text fl" id="key" name="key" value="${key}" placeholder="搜索商品"> <input type="submit" class="input_btn fr" value="搜索">
			</form>
		</div>
		<div class="guest_cart fr">
			<a href="${pagePath}/cart.do" class="cart_name fl">我的购物车</a>
		</div>
	</div>
	<div class="navbar_con">
		<div class="navbar">
			<div class="subnav_con fl">
				<h1 class="fl">商品区</h1>
				<span></span>
				<ul class="subnav">
					<c:forEach items="${types}" var="type">
						<li><a href="${pagePath}/goods.do?type_id=${type.id}">${type.name}</a></li>
					</c:forEach>
				</ul>
			</div>
			<ul class="navlist fl">
				<li><a href="${pagePath}/index.do" class="active">商品区</a></li>
				<li class="interval">|</li>
				<li><a href="${pagePath}/index_task.do">任务区</a></li>
				<li class="interval">|</li>
				<li><a href="${pagePath}/personal_info.do">个人中心</a></li>
				<li class="interval">|</li>
				<li><a href="${pagePath}/cart.do">购物车</a></li>
			</ul>
		</div>
	</div>
	<div class="breadcrumb">
		<a href="${pagePath}/goods.do">全部分类</a>
		<c:if test="${!empty type}">
			<span>></span>
			<a href="${pagePath}/goods.do?type_id=${type.id}">${type.name}</a>
		</c:if>
	</div>
	<div class="main_wrap clearfix">
		<div class="r_wrap clearfix">
			<div class="sort_bar">
				<c:if test="${empty sort || sort eq '0'}">
					<a href="${pagePath}/goods.do?type_id=${type.id}&sort=0" class="active">默认</a>
					<a href="${pagePath}/goods.do?type_id=${type.id}&sort=1">最新</a>
					<a href="${pagePath}/goods.do?type_id=${type.id}&sort=2">价格</a>
				</c:if>
				<c:if test="${sort eq '1'}">
					<a href="${pagePath}/goods.do?type_id=${type.id}&sort=0">默认</a>
					<a href="${pagePath}/goods.do?type_id=${type.id}&sort=1" class="active">最新</a>
					<a href="${pagePath}/goods.do?type_id=${type.id}&sort=2">价格</a>
				</c:if>
				<c:if test="${sort eq '2'}">
					<a href="${pagePath}/goods.do?type_id=${type.id}&sort=0">默认</a>
					<a href="${pagePath}/goods.do?type_id=${type.id}&sort=1">最新</a>
					<a href="${pagePath}/goods.do?type_id=${type.id}&sort=2" class="active">价格</a>
				</c:if>
			</div>
			<ul class="goods_type_list clearfix">
				<c:forEach items="${goodsList}" var="goods">
					<li><a href="${pagePath}/goods_details.do?goods_id=${goods.id}"><img src="${pagePath}${goods.picture}"></a>
						<h4>
							<a href="${pagePath}/goods_details.do?goods_id=${goods.id}">${goods.name}</a>
						</h4>
						<div class="operate">
							<span class="prize">￥${goods.price}</span> <a href="${pagePath}/cart_add.do?goods_id=${goods.id}" class="add_goods" title="加入购物车"></a>
						</div></li>
				</c:forEach>
			</ul>
			<c:if test="${empty goodsList}">
				<h3 align="center">没有商品信息！</h3>
			</c:if>
		</div>
	</div>
	<jsp:include page="footer.jsp"></jsp:include>
</body>
</html>